package com.amqp.demo;

import com.amqp.demo.HelloWorldConfiguration;
import org.springframework.amqp.core.*;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * 声明队列
 */
public class DeclareConfigApp {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext context=new AnnotationConfigApplicationContext(HelloWorldConfiguration.class);
        AmqpAdmin amqpAdmin = context.getBean(AmqpAdmin.class);
        Queue queue101 = new Queue("queue-101");
        queue101.getArguments().put("x-dead-letter-exchange","amq.direct");
        queue101.getArguments().put("x-dead-letter-routing-key","dead100");
        amqpAdmin.declareQueue(queue101); // 声明队列

        //amqpAdmin.deleteQueue("queue-101"); // 删除队列
        //amqpAdmin.declareBinding(BindingBuilder.bind(new Queue("queue-101")).to(new DirectExchange("amq.direct")).with("100")); //绑定队列


    }
}
